<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body>
  <ui:composition>
      <div id="post">
        <h2>
          <h:link outcome="#{links.postPage}" value="#{post.title}">
            <f:param name="id" value="#{post.id}" />
          </h:link>
        </h2>

        <h:form>
          <ul class="nav nav-pills">
            <li>
              <h:link outcome="#{links.editPostPage}" value="Edit" rendered="#{user.logged}">
                <f:param name="id" value="#{post.id}" />
              </h:link>
            </li>
            <li>
              <h:commandLink actionListener="#{removePost.remove(post.id)}" value="Remove" rendered="#{user.logged}" />
            </li>
          </ul>
        </h:form>

        <div class="article">
          <h:outputText value="#{post.content}" escape="false" />
        </div>

        <div class="tags">
          <h:form>
            <ui:repeat value="#{post.tags}" var="t">
              <h:link styleClass="btn" value="#{t}" outcome="#{links.indexPage}">
                <f:param name="tag" value="#{t}" />
              </h:link>
            </ui:repeat>
          </h:form>
        </div>
        <div class="article-footer">
          <h:outputText value="Created on #{post.created}" /> | <h:outputText value="Modified on #{post.modified}" /> | <h:outputText value="Author is #{post.author}" />
        </div>
      </div>
  </ui:composition>
</h:body>
</html>
